package net.scribblemedia.candle.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.FetchType;
import javax.persistence.ManyToMany;

import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class TrainingPlan {

    @ManyToMany(fetch=FetchType.EAGER)
    private Set<TrainableNetwork> trainableNetworks;
	
    @ManyToMany(fetch=FetchType.EAGER)
	private Set<TickerSymbol> tickerSymbols;
	
	private Date trainingPeriodStartDate;
	
	private Date trainingPeriodEndDate;
	
	private int tailSizeDays;
	
	private int noseSizeDays;
	
	private int endOfNoseGainPeriodDays;
	
	private double maxErrorRate;
	
	private double minimumGainPercentage;
	
	private double flatGainThresholdPercentage;
	
	private boolean trained;

	void addTrainableNetworkInternal(TrainableNetwork trainableNetwork) {
		if (trainableNetworks == null) {
			trainableNetworks = new HashSet<TrainableNetwork>();
		}
		
		trainableNetworks.add(trainableNetwork);
	}
	
	public void addTickerSymbol(TickerSymbol tickerSymbol) {
		if (tickerSymbols == null) {
			tickerSymbols = new HashSet<TickerSymbol>();
		}
		
		tickerSymbols.add(tickerSymbol);
	}
	
}
